<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>微信账号绑定</title>
<link rel="stylesheet" type="text/css" href="/static/hui/css/hui.css" />
<link rel="stylesheet" href="__CSS__/fonts.css">
</head>

<body style="background:url(/static/user/images/login/mobile_bg_3.jpg);background-size:100%;">
<div class="hui-wrap">
    <div style="margin-top:55px;height:100px;text-align: center;"><h1 style="border:0px;"><img src="{$wxuser.headimgurl}"></h1></div>
    <form class="layui-form" id="loginForm" action="{:url('user/weixin/bangding')}" method="post">
        <div style="margin:20px 10px; margin-bottom:15px;" class="hui-form" id="form1">
            <div class="hui-form-items">
                <div class="hui-form-items-title">账号/手机</div>
                <input type="text" name="username" id="username" lay-verify="required" autocomplete="off" class="hui-input hui-input-clear">
            </div>
            <div class="hui-form-items">
                <div class="hui-form-items-title">登录密码</div>
                <input type="password" name="password" id="password" lay-verify="required" autocomplete="off" class="hui-input hui-pwd-eye">
            </div>
            <div class="hui-form-items">
                <div class="hui-form-items-title">验证码</div> 
                <input type="number" name="captcha" lay-verify="required" autocomplete="off" class="hui-input">
                <div style="width:180px;">
                    <img class="validate-code verifyImg" src="{:url('user/index/captcha')}" onclick="this.src='{:url('user/index/captcha')}?rand='+Math.random()"  width="100%"/>
                </div>
            </div>
        </div>
        <div style="padding:10px; padding-top:10px;">
            <button class="hui-button hui-button-large hui-primary" lay-submit lay-filter="login">绑 定</button>
        </div>
    </form>
    
    <div class="hui-common-title" style="margin-top:15px;">
        <div class="hui-common-title-line"></div>
        <div class="hui-common-title-txt">六诺科技 版权所有</div>
        <div class="hui-common-title-line"></div>
    </div>
</div>
<script type="text/javascript" src="/static/hui/js/hui.js" charset="UTF-8"></script>
<script type="text/javascript" src="/static/hui/js/hui-form.js" charset="utf-8"></script>
<script src="__LIBS__/layui/layui.js"></script>
<script>
    layui.use(['layer', 'form', 'jquery'], function(){
        var layer = layui.layer,
            form  = layui.form,
            $     = layui.jquery;
        form.on('submit(login)', function(data) {
            var index = layer.msg('登录中，请稍候', {
                icon: 16,
                time: false,
                shade: 0.3
            });
            $.ajax({
                url: data.form.action,
                type: data.form.method,
                dataType: 'json',
                data: $(data.form).serialize(),
                success: function(result) {
                    if (result.code === 1) {
                        location.href = result.url;
                    } else {
                        $('.captcha img').attr('src', '{:url("user/index/captcha")}?rand='+Math.random());
                        layer.close(index);
                        layer.msg(result.msg);
                    }
                },
                error: function (xhr, state, errorThrown) {
                    layer.close(index);
                    layer.msg(state + '：' + errorThrown);
                }
            });
            return false;
        });
    });
</script>
</body>
</html>